//
//  YuyueTableViewCell.m
//  QQRunning
//
//  Created by Apple on 2017/7/18.
//  Copyright © 2017年 软盟. All rights reserved.
//

#import "YuyueTableViewCell.h"

@implementation YuyueTableViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self newView];
       
    }
    return self;
}


-(void)newView{
    _bgView = [UIView new];
    _bgView.backgroundColor = whiteLineColore;
    [self addSubview:_bgView];
    
    UILabel *yuyueTime = [[UILabel alloc] init];
    yuyueTime.textColor  = grayTextColor;
    yuyueTime.font = SmallFont(self.scale);
    [_bgView addSubview:yuyueTime];
    
    for (int i = 0; i<4; i++) {
        UILabel *lab = [[UILabel alloc] init];
        lab.textColor  = grayTextColor;
        lab.font = SmallFont(self.scale);
        lab.tag = 100+i;
        [_bgView addSubview:lab];
    }
    _yuyueTimeLabel = [_bgView viewWithTag:100];
    _addressLabel = [_bgView viewWithTag:101];
    _shengyuLabel = [_bgView viewWithTag:102];
    _beiZhuLabel = [_bgView viewWithTag:103];
    
    
    
    
    
    
//    //备注
//    _beiZhuLabel = [UILabel new];
//    _beiZhuLabel.textColor = grayTextColor;
//    _beiZhuLabel.font = SmallFont(self.scale);
//    [_bgView addSubview:_beiZhuLabel];
    
    _yuyueButton = [UIButton new];
    [_yuyueButton setTitle:@"预约培训" forState:UIControlStateNormal];
    [_yuyueButton setBackgroundColor:mainColor];
    _yuyueButton.titleLabel.font = Big15Font(self.scale);
    [_yuyueButton setTitleColor:whiteLineColore forState:UIControlStateNormal];
    _yuyueButton.layer.cornerRadius = RM_CornerRadius;
    _yuyueButton.clipsToBounds = YES;
    [_yuyueButton addTarget:self action:@selector(qiangDanButtonEvent:) forControlEvents:UIControlEventTouchUpInside];
    [_bgView addSubview:_yuyueButton];
}
-(void)layoutSubviews{
    _bgView.frame = CGRectMake(RM_Padding, 0, self.width - 2*RM_Padding, self.height);
    _bgView.layer.borderWidth = 0.5;
    _bgView.layer.borderColor = blackLineColore.CGColor;
    _bgView.layer.cornerRadius = 5*self.scale;
    _bgView.clipsToBounds = YES;
    
    _yuyueTimeLabel.frame = CGRectMake(10, 0, _bgView.width, 25*self.scale);
    
    _addressLabel.frame = CGRectMake(10, _yuyueTimeLabel.bottom, _bgView.width, 25*self.scale);
    _shengyuLabel.frame = CGRectMake(10, _addressLabel.bottom, _bgView.width, 25*self.scale);
    _beiZhuLabel.frame = CGRectMake(10, _shengyuLabel.bottom, _bgView.width, 25*self.scale);

    
    
    _yuyueButton.frame = CGRectMake(10, _beiZhuLabel.bottom+RM_Padding/2, _beiZhuLabel.width-20 , RM_ButtonHeight);
    

//    CGFloat setY=_orderDecLabel.bottom;
//    _goodsLabel.hidden=NO;
//    _beiZhuLabel.hidden=NO;
//    _yiSuiBaoWenL.hidden = NO;
//    _baoJiaL.hidden = NO;
//    
//    _qiangDanButton.top=setY+RM_Padding;
}
-(void)qiangDanButtonEvent:(UIButton *)button{
    if (_delegate && [_delegate respondsToSelector:@selector(OrderTableViewCellQiangDanWithIndex:)]) {
        [_delegate OrderTableViewCellQiangDanWithIndex:_indexPath];
    }
}


@end
